<style>
    .fenlei{width:49%;font-weight:400 !important;background:#f3f3f3;margin-right:1%;height:40px;line-height:40px;padding-left:16px;}
    .fenlei a{float:right;font-size:40px;color:#979797;height:40px;line-height:35px;margin-right:16px;}
</style>
<div class="col-md-12">
    <form action="" method="post">
        <div class="card">
            <div class="card-header">
                <h3 class="card-title"><?php if($info) { echo '修改'; } else { echo '添加'; } ?>客户</h3>
            </div>
            <div class="card-body">
                <div class="form-group">
                    <label>客户姓名</label>
                    <input type="text" name="name" value="{$info.name}" class="form-control my-colorpicker1">
                </div>
                <div class="form-group">
                    <label>客户电话</label>
                    <input type="text" name="phone" value="{$info.phone}" class="form-control my-colorpicker1">
                </div>
                <div class="form-group">
                    <label>公司名</label>
                    <input type="text" name="company" value="{$info.company}" class="form-control my-colorpicker1">
                </div><?php if(session('u_info.admin_group') != 2 ) { ?>
                <div class="form-group">
                    <label>所属业务员</label>
                    <select class="form-control my-colorpicker1 select2" name="uid" style="width: 100%;">
                        <option value="{$info.uid}"><?php if($uid_info){ echo $uid_info['username'].' '.$uid_info['nickname']; } else { echo '请选择'; } ?></option>
                    </select>
                </div>
                <?php } else if(session('u_info.admin_group_leader') != 1 && $info['uid'] == session('u_info.id')){ ?>
                <input type="hidden" name="uid" value="{:session('u_info.id')}"/>
                <?php }?>
            </div>
            <div class="card-footer">
                <button type="submit" class="btn btn-primary">提交</button>
            </div>
        </div>
    </form>
</div>
<script>
    $(function () {
        $('.fenlei a').html('×');
        $(".select2").select2({
            ajax: {
                type: 'GET',
                url: "{:U('User/get_user_admin_list')}",
                dataType: 'json',
                data: function (params) {
                    return {
                        key: params.term
                    };
                },
                processResults: function (data, params) {
                    return {
                        results: data
                    };
                },
                cache: true
            },
            placeholder: '请选择', //默认文字提示
            escapeMarkup: function (markup) {
                return markup;
            }, // 自定义格式化防止xss注入
            minimumInputLength: 1, //最少输入多少个字符后开始查询
            formatResult: function formatRepo(repo) {
                return repo.text;
            }, // 函数用来渲染结果
            formatSelection: function formatRepoSelection(repo) {
                return repo.text;
            } // 函数用于呈现当前的选择
        });
    })
</script>